#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
int main()
{
  pid_t id=fork();
  if(id>0)
  {
    //父进程
    int count=4;
    while(count--)
    {
      printf("i am father pid:%d ppid:%d\n",getpid(),getppid());
      sleep(1);
    }
    exit(1);
  }
  //子进程
  while(1)
  {
    printf("i am son pid:%d ppid:%d\n",getpid(),getppid());
    sleep(2);
  }
  exit(1);
  return 0;
}
